/**
 * 复制文字到粘贴板
 * @param text
 */
export function copyToClipboard (text: string) {
  document.addEventListener('copy', handler)
  document.execCommand('copy')
  function handler (event: any) {
    event.clipboardData.setData('text/plain', text)
    event.preventDefault()
    document.removeEventListener('copy', handler)
  }
}
